<?php $this->load->view('common/head');?>
<?php $this->load->view('common/navbar');?>
<form class="form-inline" method="GET" action="<?php echo $this->input->server('REQUEST_URI'); ?>" name="queryForm" id="queryForm">
<input type="hidden" name="c" id="c" value="<?php echo $this->input->get('c') ?>">
<input type="hidden" name="m" id="m" value="<?php echo $this->input->get('m') ?>">
  <div class="form-group form-group-sm">
    <label for="year">所属年份：</label>
    <select class="form-control" id="year" name="year">
      <option value="">请选择</option>
    </select>
  </div>
  <div class="form-group form-group-sm">
    <label for="timeUnit">所属双月：</label>
    <select class="form-control" id="timeUnit" name="timeUnit">
      <option value="">请选择</option>
	</select>
  </div>
  <!-- <div class="form-group form-group-sm">
    <label for="timeUnit">所属周：</label>
    <select class="form-control" placeholder=".col-xs-4" id="weekNum" name="weekNum">
      <option value="">请选择</option>
  	</select>
  </div> -->
 <div class="form-group form-group-sm">
  <button type="submit" class="btn btn-primary btn-sm">查询</button>
  </div>
</form>
<div>
<div style="width: 170px;float: left;">
<table class="table table-bordered table-condensed text-center">
  <thead align="center">
    <tr style="line-height: 90px;">
      <td><h2>管控数据</h2></td>
    </tr>
    <tr>
      <td>来店量达成标准进度</td>
    </tr>
    <tr>
      <td>双月来店量目标</td>
    </tr>
    <tr>
      <td>来店量实际</td>
    </tr>
    <tr>
      <td>来店量目标达成率</td>
    </tr>
    <tr>
      <td>提车实际</td>
    </tr>
    <tr>
      <td>提车达成</td>
    </tr>
    <tr>
      <td>交车实际</td>
    </tr>
    <tr>
      <td>交车达成</td>
    </tr>
    <tr>
      <td>转换率</td>
    </tr>
  </thead>
</table>
</div>
<div style="width: 830px;float: right;" class="table-responsive">
<table class="table table-bordered table-condensed text-center" style="width: <?=830*count($timeUnitList)?>px;">
	<thead>
	  <tr>
		<?php foreach ($timeUnitList as $timeUnitK => $timeUnitV): ?>
	  	<th colspan="<?=count((array)$timeUnitV['weekList'])?>"><?=$timeUnitV['name']?></th>
		<?php endforeach ?>
	  </tr>
	  <tr>
		  <?php foreach ($timeUnitList as $timeUnitK => $timeUnitV): ?>
		  	<?php foreach ((array)$timeUnitV['weekList'] as $weekK => $weekV): ?>
		  	<td class="text-center"><?=$weekV?></td>
		  	<?php endforeach ?>
	  	  <?php endforeach ?>
	  </tr>
	  </thead>
	<tbody>
		<tr align="center">
			<?php foreach ($timeUnitList as $timeUnitK => $timeUnitV): ?>
			<td colspan="<?=count((array)$timeUnitV['weekList'])?>"><?=$reachStandard?>&nbsp;</td>
			<?php endforeach ?>
		</tr>
		<tr align="center">
			<?php foreach ($timeUnitList as $timeUnitK => $timeUnitV): ?>
			<td colspan="<?=count((array)$timeUnitV['weekList'])?>"><?=isset($unitDataList[$timeUnitK]) ? $unitDataList[$timeUnitK]['comeStoreTarget'] : "&nbsp;"?></td>
			<?php endforeach ?>
		</tr>
		<tr align="center">
		  <?php foreach ($timeUnitList as $timeUnitK => $timeUnitV): ?>
		  	<?php foreach ((array)$timeUnitV['weekList'] as $weekK => $weekV): ?>
			<td><?=isset($weekDataList[$timeUnitK][$weekK]) ? $weekDataList[$timeUnitK][$weekK]['comeStoreActual'] : "&nbsp;"?></td>
			<?php endforeach ?>
	  	  <?php endforeach ?>
		</tr>
		<tr align="center">
			<?php foreach ($timeUnitList as $timeUnitK => $timeUnitV): ?>
		  	<?php foreach ((array)$timeUnitV['weekList'] as $weekK => $weekV): ?>
			<td><?=isset($weekDataList[$timeUnitK][$weekK]) ? $weekDataList[$timeUnitK][$weekK]['comeStoreRate'].'%' : "&nbsp;"?></td>
			<?php endforeach ?>
	  	  <?php endforeach ?>
		</tr>
		<tr align="center">
			<?php foreach ($timeUnitList as $timeUnitK => $timeUnitV): ?>
		  	<?php foreach ((array)$timeUnitV['weekList'] as $weekK => $weekV): ?>
			<td><?=isset($weekDataList[$timeUnitK][$weekK]) ? $weekDataList[$timeUnitK][$weekK]['pickCarActual'] : "&nbsp;"?></td>
			<?php endforeach ?>
	  	  <?php endforeach ?>
		</tr>
		<tr align="center">
			<?php foreach ($timeUnitList as $timeUnitK => $timeUnitV): ?>
		  	<?php foreach ((array)$timeUnitV['weekList'] as $weekK => $weekV): ?>
			<td><?=isset($weekDataList[$timeUnitK][$weekK]) ? $weekDataList[$timeUnitK][$weekK]['pickCarRate'].'%' : "&nbsp;"?></td>
			<?php endforeach ?>
	  	  <?php endforeach ?>
		</tr>
		<tr align="center">
			<?php foreach ($timeUnitList as $timeUnitK => $timeUnitV): ?>
		  	<?php foreach ((array)$timeUnitV['weekList'] as $weekK => $weekV): ?>
			<td><?=isset($weekDataList[$timeUnitK][$weekK]) ? $weekDataList[$timeUnitK][$weekK]['deliveryActual'] : "&nbsp;"?></td>
			<?php endforeach ?>
	  	  <?php endforeach ?>
		</tr>
		<tr align="center">
			<?php foreach ($timeUnitList as $timeUnitK => $timeUnitV): ?>
		  	<?php foreach ((array)$timeUnitV['weekList'] as $weekK => $weekV): ?>
			<td><?=isset($weekDataList[$timeUnitK][$weekK]) ? $weekDataList[$timeUnitK][$weekK]['deliveryRate'].'%' : "&nbsp;"?></td>
			<?php endforeach ?>
	  	  <?php endforeach ?>
		</tr>
		<tr align="center">
			<?php foreach ($timeUnitList as $timeUnitK => $timeUnitV): ?>
		  	<?php foreach ((array)$timeUnitV['weekList'] as $weekK => $weekV): ?>
			<td><?=isset($weekDataList[$timeUnitK][$weekK]) ? $weekDataList[$timeUnitK][$weekK]['transRate'].'%' : "&nbsp;"?></td>
			<?php endforeach ?>
	  	  <?php endforeach ?>
		</tr>
	</tbody>
</table>
</div>
</div>
<div class="margin-top-30">&nbsp;</div>
<script type="text/javascript">
$(function(){
    loadYearList('year',<?=$year ? $year : 0?>);
    loadTimeUnitList('timeUnit',<?=$year ? $year : 0?>,<?=$timeUnit ? $timeUnit : 0?>);
    loadWeekList('weekNum',<?=$year ? $year : 0?>,<?=$timeUnit ? $timeUnit : 0?>,<?=$weekNum ? $weekNum : 0?>);
});
$("#year").change(function(){
    loadTimeUnitList('timeUnit',this.value);
    loadWeekList('weekNum',this.value,0);
  });
$("#timeUnit").change(function(){
  loadWeekList('weekNum',$("#year").val(),this.value);
});
</script>
<?php $this->load->view('common/foot');?>